home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / RemoteMailCompose / RemoteComposeController.m < prev   
Text File  |  1995-06-12  |  2KB  |  64 lines

  1. //----------------------------------------------------------------------------------------------------
  2. //
  3. //    RemoteComposeController
  4. //
  5. //    Inherits From:        Object
  6. //
  7. //    Declared In:        RemoteComposeController.h
  8. //
  9. //    Disclaimer
  10. //
  11. //        You may freely copy, distribute and reuse this software and its
  12. //        associated documentation. I disclaim any warranty of any kind, 
  13. //        expressed or implied, as to its fitness for any particular use.
  14. //
  15. //----------------------------------------------------------------------------------------------------
  16. #import "RemoteComposeController.h"
  17. #import "MailSpeaker.h"
  18.  
  19.  
  20. @implementation RemoteComposeController
  21.  
  22. - suggestion: sender
  23. {
  24.     //  Create an instance of MailSpeaker.  Get named port 'Mail' (this will launch
  25.     //  Mail.app if not already).  Get named port 'MailSendDemo' (this is the one we
  26.     //  will actually talk to, so set our speaker's port to be this one).  Could this be done 
  27.     //  with Remote Objects?  Only if NeXT's Mail.app publicly 'vends' some object in 
  28.     //  Mail.app that we may connect to.
  29.     
  30.         id         speaker = [[MailSpeaker alloc] init];
  31.         port_t     mailPort = NXPortFromName ("Mail", NULL);
  32.     int        window;
  33.     
  34.     mailPort = NXPortFromName ("MailSendDemo", NULL);
  35.  
  36.     if (mailPort == PORT_NULL) 
  37.         {
  38.         (NXRunAlertPanel ("Accessing Mail", "Unable to connect to Mail.app",  
  39.             NULL,  NULL, NULL));
  40.         return self;
  41.         }
  42.         
  43.         [speaker setSendPort: mailPort];
  44.  
  45.     //  Example using compose methods with window not specified.
  46.     [speaker openSend];
  47.     [speaker setTo: (STR) NXUserName()];
  48.     [speaker setSubject: "Comments and Suggestions"];
  49.     [speaker setBody: "Your comments and suggestions here..."];
  50.  
  51.     //  Example using compose methods with window specified.
  52.     [speaker openSend: &window];
  53.     [speaker setTo: (STR) NXUserName() inWindow: window];
  54.     [speaker setSubject: "More Comments and Suggestions" inWindow: window];
  55.     [speaker setBody: "More comments and suggestions here..." inWindow: window];
  56.  
  57.     [speaker free];
  58.     
  59.         return self;
  60. }
  61.  
  62.  
  63. @end
  64.